package com.coin900.coin.base.utils;

import com.coin900.coin.persist.fu.FuUserVO;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

/**
 * Unibon
 * <p/>
 * Copyright (c) 2012 YouPeng ValueSoft Inc., All rights reserved.
 * <p/>
 * This software is the confidential and proprietary information of
 * ValueSoft Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with ValueSoft.com.
 * <p/>
 * Revision History
 * Date      		Programmer       Notes
 * 14-8-3   	     laborc		     Initial
 * *********************************************************************
 */
public class SessionUtils {
    public static FuUserVO getUser() {
        Subject currentUser = SecurityUtils.getSubject();
        Session session = currentUser.getSession();
        FuUserVO user = (FuUserVO) session.getAttribute("user");
        return user;
    }

    public static void setUser(FuUserVO user) {
        Subject currentUser = SecurityUtils.getSubject();
        Session session = currentUser.getSession();
        session.setAttribute("user",user);
    }

}
